package com.suanfa.dp;

public class MinCostStep {



    public static void main(String[] args) {
        //int[] arr = {2,5,20};
        int[] arr = {1,100, 1, 1, 1, 90, 1, 1, 80, 1};

        System.out.println(getMinCost(arr.length, arr));
    }

    public static int getMinCost(int current, int[] cost){
        int[] dp = new int[current+1];

        int last =0 ;
        int lastlast = 0;
        int result = 0;
        for(int i=2; i<=current; i++){
            result = Math.min(last + cost[i-1], lastlast + cost[i-2]);
            lastlast = last;
            last = result;
        }
        return  result;
    }
}
